package com.bwie.gddproject.regist.model;

import com.bwie.gddproject.index.model.bean.BaseBean;
import com.bwie.gddproject.net.NetUtil;
import com.bwie.gddproject.net.OnNetLitenner;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by 我走路带风 on 2017/11/9.
 */

public class RegistModel implements IRegistModel {
    @Override
    public void regist(String account, String pwd, final OnNetLitenner<BaseBean> onNetListener) {


        NetUtil.getResponseService().registIn(account,pwd)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<BaseBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(BaseBean baseBean) {
                        onNetListener.success(baseBean);
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }


}
